package com.bwie.coupon.service.impl;

import com.bwie.common.core.domain.Result;
import com.bwie.coupon.domain.po.MlCoupon;
import com.bwie.coupon.domain.po.MlCouponPreferential;
import com.bwie.coupon.domain.po.MlSeller;
import com.bwie.coupon.mapper.MlCouponPreferentialMapper;
import com.bwie.coupon.service.MlCouponPreferentialService;
import com.bwie.coupon.service.MlSellerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class MlCouponPreferentialServiceImpl implements MlCouponPreferentialService {
    @Autowired
    private MlCouponPreferentialMapper mlCouponPreferentialMapper;
    @Autowired
    private MlSellerService mlSellerService;


    @Override
    public Result selectAll(Long sellerId) {
        Result<List<MlSeller>> listResult = mlSellerService.selectMlSeller(sellerId);
        List<MlSeller> list = listResult.getData();

        for (MlSeller mlSeller : list) {
            List<MlCoupon> couponList = mlSeller.getCouponList();
            mlSeller.setCouponList(couponList);
        }
        return Result.success(list);
    }

}
